define(['app'],function(app){
    return {module: function($scope, $http, eventBusService, httpService, params) {
        $scope.form = {};

        $scope.form.fk_menuid = params.id;
        $scope.form.type = "0";

        httpService.post(app.urls.rule_selectIcon,{},function(data){
    		if("0000" === data.code){
    			$scope.icons = data.data;
    		}else{
    			alert(data.msg);
    		}
    	});
        $scope.save = function() {
            if($scope.formCheck()) {
                httpService.post(app.urls.button_insert, $scope.form, function(data){
                    if("0000" === data.code){
                        eventBusService.publish("content.button.reload",data.data);
                        eventBusService.publish("modal.page.close",{});
                    }else{
                        alert(data.msg);
                    }
                });
            }
        }
    }
}});